package com.manage.controller;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.manage.model.Role;
import com.manage.service.RoleService;

@Controller
public class RoleController {
@Autowired
private RoleService roleService;

//查询所有的角色
@RequestMapping(value="rolelist")
public String listrole(Map<String,Object> map){
	List<Role> roleList = roleService.listAllRoles();
	map.put("roleList", roleList);
	return "views/role";
}

//增加角色
@RequestMapping(value="saveRole")
public ModelAndView saveRole(Role role){
	ModelAndView mav = new ModelAndView("jsonView");
	roleService.saveRole(role);
	mav.addObject("success",true);
	mav.setViewName("views/role_result");
	return mav;
}
}
